home *** CD-ROM | disk | FTP | other *** search
- /* Copyright, 1990, Regents of the University of Colorado */
- /* 6/27 MATT, removed enum of D_first_env and D_last_env. replaced with ints*/
- /* Variables and functions exported by the DINO Library. */
-
- /* Macros */
-
- #include "D_reduct.h"
- #define D_SIM 1
- #define D_CUBE 2
- #define D_SIM2 3
- #define D_CUBE2 4
- #define D_CUBE860 5
- #define D_BOOL char
- #define TRUE ((D_BOOL) 1)
- #define FALSE ((D_BOOL) 0)
- #if (D_MACH == D_CUBE)
- #define D_NULL ((char *) 0)
- #elif (D_MACH == D_CUBE2 || D_MACH == D_CUBE860)
- #if !i286 || SMALL_M || MIDDLE_M
- #ifndef NULL
- #define NULL 0
- #else
- #define NULL 0L
- #endif
- #endif
- #define D_NULL NULL
- #else
- #define D_NULL 0
- #endif
- #define D_HOST_NID ((short int) 0x8000)
- #define D_HOST_PID 1
- #if (D_MACH == D_SIM)
- #define D_MAX_MESS 0x4000
- #elif (D_MACH == D_SIM2 || D_MACH == D_CUBE)
- #define D_MAX_MESS 0x4000
- #else
- #define D_MAX_MESS 0x8000
- #endif
- #define D_TYPE_BLOCK_START 30720
- #define D_TYPE_BLOCK_SIZE 2048
- #define D_PM_HD_SZ (2 * sizeof(long int))
- #define D_MP_HD_SZ (3 * sizeof(long int))
- #define D_LM_HD_SZ (2 * sizeof(long int))
- #define D_LME_CPC_HD_SZ (5 * sizeof(long int))
- #define D_LME_CPR_HD_SZ (3 * sizeof(long int))
- #define D_LME_DATA_HD_SZ (3 * sizeof(long int))
- #define D_CPC_MTYPE 0
- #define D_MAX_STRUCTURES 10
- #define D_MAX_ENVS 128
- #define D_min(x,y) (x<y?x:y)
- #define D_max(x,y) (x>y?x:y)
-
- #if (D_MACH == D_CUBE)
- #define D_init_bitmap d_init_bitmap
- #define D_mem_copy d_mem_copy
- #endif
-
- #if (D_MACH == D_CUBE2)
- #define D_mem_copy memcpy
- #endif
-
- /* Macros for the new composite procedure stuff */
-
- /* The following object allows referencing D_mess_tmp in long ints */
- #define D_mess_lint ((long int *) &D_mess_tmp [0])
-
-
- /* Types */
-
- typedef struct {
- int count;
- int name;
- D_BOOL allflag;
- D_BOOL implicit;
- D_BOOL *bitmap;
- } D_env_set;
-
- typedef struct {
- long int first;
- long int last;
- long int size;
- } D_range_desc;
-
- typedef struct {
- long int first;
- long int last;
- } D_sh_range_desc;
-
- typedef struct {
- char *loc;
- long int size;
- } D_storage_space_desc;
-
- typedef struct {
- D_BOOL needed;
- int elem_size;
- int dims;
- D_range_desc *range;
- } D_data_distribution_desc;
-
- typedef struct {
- int (* type)();
- D_BOOL simple;
- int dims;
- D_sh_range_desc *range;
- } D_data_name_desc;
-
- typedef struct {
- long int l_over;
- long int l_main;
- long int r_main;
- long int r_over;
- int env;
- } D_entry;
-
- typedef struct {
- long int size;
- long int data_size;
- long int env_size;
- long int node_size;
- int align;
- int pieces;
- long int wrap;
- long int offset;
- D_BOOL wrapflag;
- D_BOOL compress;
- D_BOOL allflag;
- D_entry *list;
- } D_env_map;
-
- typedef struct {
- int name;
- int dims;
- int env_dims;
- int elem_size;
- D_BOOL allflag;
- D_BOOL *cross;
- D_env_map *envm;
- D_BOOL converted;
- } D_data_mapping_desc;
-
- typedef enum {gmax, gmin, gsum, gprod, gmaxdex, gmindex
- } D_reduct;
-
- typedef struct {
- char *name; /*name of file to load*/
- D_BOOL is_host; /*if it is host*/
- D_BOOL on_host; /*if it is to be loaded on host*/
- int n_dims; /*number of dims in structure*/
- int *dim; /*the size of each dim*/
- int size; /*total number of environments*/
- D_BOOL is_big; /*if size > number of processors*/
- int start; /*where to start placing envs if !is_big*/
- int pid; /*first pid to use for this structure*/
- int *pids; /*number of processes/processor for each dim*/
- int *mach_dim; /*lg of size of each dim for the target mach:
-
- * eg: a 4x8 env is mapped onto a machine which is
- * 4x4 which results in lg(4)xlg(4) = 2x2
- * 2x16 mapped to 1x16 so 0x4
- * 4x16 mapped to 2x8 so 1x3
- * NB. sum of mach_dims = dimension of cube */
- } D_env_tbl;
-
- typedef struct {
- D_storage_space_desc *store;
- D_data_mapping_desc *map;
- D_data_distribution_desc *dist;
- } D_parm;
-
- typedef struct {
- int numb;
- D_parm *parm;
- } D_parm_list;
-
- typedef struct {
- int name;
- int index;
- } envvar;
-
- typedef struct {
- int node;
- int pid;
- } D_process;
-
- typedef struct {
- int type;
- } D_type_desc;
-
- typedef enum {D_route_pair, D_route_rcvsnd, D_route_recv} D_route_type;
-
- typedef struct {
- long int size;
- long int current;
- long int incr;
- long int chunks;
- long int wcurrent;
- long int jump;
- long int loff;
- long int adj;
- } D_copy_list_2;
-
- typedef struct {
- int dims;
- long int start;
- long int current;
- long int stop;
- int level;
- D_copy_list_2 *part;
- } D_copy_list;
-
- typedef struct {
- int index;
- D_BOOL main;
- D_BOOL over;
- long int stop;
- long int start;
- long int r_main;
- long int l_main;
- int piece;
- long int size;
- } D_analysis;
-
- typedef struct {
- int type;
- int dims;
- D_sh_range_desc *range;
- } D_int_dnd;
-
-
- typedef struct {
- int total; /* Number of active
- environments in array. */
- int name; /* Name of this
- environment structure. */
- int index; /* Index of this environment. */
- D_BOOL implicit; /* Environment was determined by dmd. */
- D_BOOL *contig; /* Data is physically contiguous. */
- D_BOOL done; /* Message for this environment was
- received (or if async,
- environment was checked). */
- int header; /* Size of the header for this message. */
- int type; /* Message type for receipt
- of subsequent parts.*/
- char **loc; /* Pointer to contiguous data start. */
- char *mess; /* Pointer to received message. */
- D_int_dnd *desc; /* Pointer to dnd
- for this environment. */
- long int *size; /* Size of data in message. */
- int node; /* Node number for this environment. */
- int pid; /* Pid number for this environment. */
- int parts; /* Number of parts for this message. */
- long int offset; /* Current offset in message
- (used for contiguous copies). */
- D_copy_list **clist; /* Copy list for this environment. */
- } D_np;
-
- typedef struct {
- D_np *e;
- D_data_name_desc *n;
- D_analysis *a;
- } D_data_holder;
-
- /* Functions */
-
- #define D_quick_send_olap(dS,dE,dD,dM,dN,dC,oL,oR,oA,oD,P) \
- D_quick_olap(1,dS,dE,dD,dM,dN,TRUE,dC,oL,oR,oA,oD,P)
-
- #define D_quick_recv_olap(dS,dE,dD,dM,dN,dY,dC,oL,oR,oA,oD,P) \
- D_quick_olap(0,dS,dE,dD,dM,dN,dY,dC,oL,oR,oA,oD,P)
-
- extern void D_lib_send();
- extern void D_lib_recvs();
- extern void D_isend_init();
- extern void D_lib_isend();
- extern void D_lib_irecv();
-
- extern void D_env_init();
- extern envvar D_from();
- extern D_recv_no_storage();
-
- /* This is the new composite procedure stuff */
- extern int D_lib_cpc_a_init();
- extern D_BOOL D_lib_cpc_a_next();
- extern void D_lib_cpr_a_init();
- extern D_BOOL D_lib_cpr_a_next();
-
- extern int D_lib_cpc_f_init();
- extern void D_lib_cpr_f_init();
-
- extern long int D_block_func_l();
- extern long int D_block_func_r();
-
- extern void D_lib_flush_buf();
- extern void D_lib_refresh_buf();
- extern void D_lib_align();
-
- /* END (new stuff) */
-
- extern void D_comp_driver();
- extern void D_init_bitmap();
-
-
- /* Data */
-
- extern void (*D_comps[])();
- extern envvar caller;
- extern D_env_tbl D_env_table[];
- extern int *(D_local_env_table[]);
- /*extern enum D_env_names D_first_env, D_last_env;*/
- extern int D_first_env, D_last_env;
- extern D_BOOL D_route_stack[]; /*1<<upper(lg(size)) ie 2^n and >= size*/
- extern short int D_route_children[]; /*1<<upper(lg(size)) ie 2^n and >= size*/
- extern D_BOOL D_route_tree_map[]; /*size of my_env*/
- #if D_MACH==D_CUBE2 || D_MACH==D_SIM2 || D_CUBE860
- extern long D_gsend[];
- #endif
-
- /* Here's the stuff for the new composite procedures */
- extern char *D_buf;
- extern double D_mess_tmp [];
- extern long int D_rem;
- extern int D_le;
- extern int D_main_type;
- extern int D_sub_type;
- extern D_env_set *D_es;
- extern int D_cp;
- extern int D_env_size;
- extern int D_n_envs;
- extern D_BOOL D_first_msg;
- extern int D_node;
- extern int D_pid;
- extern long int D_size;
-